# components/mqtt/CMakeLists.txt

# --- 创建 Paho C++ 导入目标 ---
add_library(PahoMqtt::Cpp SHARED IMPORTED GLOBAL) 

set_target_properties(PahoMqtt::Cpp PROPERTIES
    IMPORTED_LOCATION "/usr/local/lib/libpaho-mqttpp3.so" 
    INTERFACE_INCLUDE_DIRECTORIES "/usr/local/include;/usr/local/include/mqtt;${CMAKE_CURRENT_SOURCE_DIR}/include"
)

add_library(PahoMqtt::C SHARED IMPORTED GLOBAL)
set_target_properties(PahoMqtt::C PROPERTIES
    IMPORTED_LOCATION "/usr/local/lib/libpaho-mqtt3a.so" 
    INTERFACE_INCLUDE_DIRECTORIES "/usr/local/include;/usr/local/include/mqtt"
)

target_link_libraries(PahoMqtt::Cpp INTERFACE PahoMqtt::C Threads::Threads)

message(STATUS "MQTT component: Created imported targets PahoMqtt::Cpp and PahoMqtt::C")